package com.personal.book1.config;


import com.personal.book1.model.BookInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
public class BookInfoBeanConfig {

    @Primary
    @Bean({"b1","b2"})
    public BookInfo getBookBean1() {
        BookInfo bookInfo = new BookInfo();
        bookInfo.setBookAuthor("张三");
        bookInfo.setBookName("张三的书");
        bookInfo.setBookId(1);
        return bookInfo;
    }

    @Bean("b3")
    public BookInfo getBookBean2() {
        BookInfo bookInfo = new BookInfo();
        bookInfo.setBookAuthor("李四");
        bookInfo.setBookName("李四的书");
        bookInfo.setBookId(2);
        return bookInfo;
    }
}
